package com.sebastian.studies.ch4;

public class Excercise_break_continue {

	public static void main(String[] args) {

		while(true) {
			System.out.println("before break");
			//without break it would be infinite loop
			break;
		}
		System.out.println("after break. Without break it would be an infinite loop");

		int sum = 0;
		int number = 0;
		while(number < 100) {
			number++;
			sum += number;
			if(sum > 1000) break;
		}
		System.out.println("Number: " + number + "\nSum:" + sum);

		int aNumber = 0;
		int bSum = 0;
		while(aNumber < 100) {
			aNumber++;
			if(aNumber == 10 || aNumber == 100) continue;
			bSum += aNumber;
		}
		System.out.println("Number: " + aNumber + "\nSum:" + bSum);

	}

}
